# Maintainer: Muflone http://www.muflone.com/contacts/english/
# Contributor: Brian Bidulock <bidulock@openss7.org>
# Contributor: John D Jones III AKA jnbek <jnbek1972 -_AT_- g m a i l -_Dot_- com>

pkgname=perl-glib-object-introspection
_perl_namespace=Glib
_perl_module=Object-Introspection
pkgver=0.050
pkgrel=1
pkgdesc="Dynamically create Perl language bindings"
arch=('loong64' 'x86_64')
url="https://metacpan.org/release/${_perl_namespace}-${_perl_module}"
license=('LGPL')
makedepends=('gobject-introspection' 'perl-extutils-depends' 'perl-extutils-pkgconfig' 'perl-cairo-gobject')
depends=('glib-perl' 'gobject-introspection-runtime')
source=("https://cpan.metacpan.org/authors/id/X/XA/XAOC/${_perl_namespace}-${_perl_module}-${pkgver}.tar.gz")
sha512sums=('3939a7d96800416ca4e52bf263b5b84dde0a5dbe5ed636dc6668ee005c1f018e5988f8e0ba059165f966a05b5efc992391ae0de991e87b9118fab92ee39f97f4')
options=('!emptydirs')

build() {
  cd "${_perl_namespace}-${_perl_module}-${pkgver}"
  unset PERL5LIB PERL_MM_OPT PERL_MB_OPT PERL_LOCAL_LIB_ROOT
  export PERL_MM_USE_DEFAULT=1 PERL_AUTOINSTALL=--skipdeps
  perl Makefile.PL
  make
}

check() {
  cd "${_perl_namespace}-${_perl_module}-${pkgver}"
  unset PERL5LIB PERL_MM_OPT PERL_MB_OPT PERL_LOCAL_LIB_ROOT
  export PERL_MM_USE_DEFAULT=1
  make test
}

package() {
  cd "${_perl_namespace}-${_perl_module}-${pkgver}"
  unset PERL5LIB PERL_MM_OPT PERL_MB_OPT PERL_LOCAL_LIB_ROOT
  make pure_install INSTALLDIRS=vendor DESTDIR="${pkgdir}"
  # Delete unuseful files
  find "${pkgdir}" -name '.packlist' -delete
}
